package com.cnsuning.jobtool;

import org.apache.commons.io.FileUtils;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.util.HashSet;


public class Test {

    /**
     * 功能描述: <br>
     * 〈功能详细描述〉
     *
     * @param args
     * @see [相关类/方法](可选)
     * @since [产品/模块版本](可选)
     */
    public static void main(String[] args) {
        File targetFile = new File("src/result.txt");
        if (targetFile.exists()) targetFile.delete();
        try{
            BufferedReader bre = new BufferedReader(new FileReader("src/copy.txt"));
            String eachLine="";
            HashSet<String> set = new HashSet<String>();
            while((eachLine = bre.readLine())!=null) {
                if(eachLine.length()==12 || eachLine.length()==14) {
                    set.add(eachLine.substring(0,12));

                }
            }
            for(String str : set) {
                FileUtils.writeStringToFile(targetFile,str+"\n","utf-8",true);
                System.out.println(str);
            }
        } catch(Exception e) {
            e.printStackTrace();
        }
    }

}
